<?php


/*
 * @license   GPLv3 Open Source
 */


defined ('IN_AGORA') or die;

class TaskController extends AgoraAdminController
{

 	function _default()
	{
		$this->view->template = 'joopport/settings';
		
		$model = & Model::getInstance('ConfigModel');
		$conf = $model->load();
		$this->view->assign('agora_config',$conf);
		
		
	}

	function _save() {
	
		if (Agora::getRequestVar('action') === 'cancel') {
			$this->redirect();
			return;
		}

		header('content-type: text/plain');

		$form = Agora::getPostVar('form',array(),true);

		$model = & Model::getInstance('ConfigModel');

		$conf = $model->load();
		$changed_data = array();
		
		foreach ($form as $var => $value) {
			if ($conf[$var] != $value) {
				$changed_data[$var] = $value;
			}

		}

		$model->save($changed_data);
		Agora::showMessage('Saved');
		$this->redirect();
	}

}

?>